<script setup>
import { useSysInfoStore } from '@/store/system';
const store = useSysInfoStore()

const goBack = () => {
  // 小程序自带的一个api
  const pages = getCurrentPages()
  if (pages.length > 1) {
    // 还有上一页
    uni.navigateBack()
  }else{
    uni.switchTab({ url: '/pages/index/index' })
  }
}
</script>

<template>
  <view @tap="goBack" :style="{top: store.capButton.top +'px'}" class="back icon-left" />
</template>

<style>
.back {
  position: absolute;
  left: 50rpx;
  z-index: 9;

  display: flex;
  justify-content: center;
  align-items: center;
  width: 60rpx;
  height: 60rpx;
  border-radius: 50%;
  font-size: 23px;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
}
</style>